package org.bigwinner.elasticsearch.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author: IT大狮兄
 * @date: 2021/8/11 上午8:50
 * @version: 1.0.0
 * @description: 配置文件读取工具类
 */
public class ConfigFileUtil {
    private static Logger LOGGER = LoggerFactory.getLogger(ConfigFileUtil.class);
    private static String fileName = "config.properties";
    private static Properties properties = new Properties();
    static {
        try {
            InputStream in = ConfigFileUtil.class.getClassLoader().getResourceAsStream(fileName);
            properties.load(in);
        } catch (IOException e) {
            LOGGER.error("Loading config.properties fails, cause = ", e);
        }
    }
    public static String getValue(String key) {
        return properties.getProperty(key);
    }
}
